package com.huawei.appgallery.foundation.ui.framework.cardframe.bean;

import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.SpinnerInfo;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.appgallery.jsonkit.api.annotation.FieldPrint;
import com.huawei.appgallery.jsonkit.api.annotation.PrintLevel;
import com.huawei.appgallery.serverreqkit.api.bean.BaseResponseBean;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse.TabInfo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import o.cib;
import o.cif;
import o.Logger;
import o.epw;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class BaseDetailResponse<T> extends BaseResponseBean implements Serializable {
    private static final String DATALIST_KEY = "dataList";
    private static final String DISPLAY_CONFIG_KEY = "displayConfig";
    public static final int LAST_PAGE = 0;
    public static final int SUPPORT_SEARCH = 1;
    private static final String TAG = "BaseDetailResponse";
    public static final int UNSUPPORT_SEARCH = 0;
    private static final long serialVersionUID = -3214905677532312281L;
    private String categoryName_;
    private int count_;
    protected JSONObject css_;
    private DataFilterSwitch dataFilterSwitch_;
    private ArrayList<TabInfo> defaultTabInfo_;
    protected int hasNextPage_;
    protected int isSupSearch_;
    protected transient List<LayoutData<T>> layoutData_ = null;
    protected transient List<Layout> layout_ = null;
    private int marginTop_ = 46;
    protected String name_;
    private int pageNum;
    private String returnTabId_;
    protected ShareInfo shareInfo_;
    protected transient SpinnerInfo spinnerInfo_;
    protected String statKey_;
    protected int supportResort_ = 0;
    private ArrayList<TabInfo> tabInfo_;
    protected String titleType_;
    private int totalPages_;

    public static class DataFilterSwitch extends JsonBean implements Serializable {
        private static final long serialVersionUID = -7037298388777938043L;
        private String name_;
        private String offvalue_;
        private String onvalue_;
        private String para_;
        private String value_;

        public String ˏ() {
            return this.para_;
        }

        public String ˋ() {
            return this.name_;
        }

        public String ˎ() {
            return this.value_;
        }

        public void ˋ(String str) {
            this.value_ = str;
        }

        public String ॱ() {
            return this.offvalue_;
        }

        public String ˊ() {
            return this.onvalue_;
        }

        public boolean ʽ() {
            return (TextUtils.isEmpty(this.para_) || TextUtils.isEmpty(this.name_) || TextUtils.isEmpty(this.offvalue_) || TextUtils.isEmpty(this.onvalue_)) ? false : true;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj instanceof DataFilterSwitch) {
                DataFilterSwitch dataFilterSwitch = (DataFilterSwitch) obj;
                if (ʽ() && this.para_.equals(dataFilterSwitch.ˏ()) && this.name_.equals(dataFilterSwitch.ˋ()) && this.offvalue_.equals(dataFilterSwitch.ॱ()) && this.onvalue_.equals(dataFilterSwitch.ˊ())) {
                    return true;
                }
            }
            return false;
        }

        public int hashCode() {
            return 0;
        }
    }

    public static class Layout extends JsonBean {
        private String css_;
        private long layoutId_;
        private String layoutName_ = null;
        private int maxRows_;

        public int ˊ() {
            return this.maxRows_;
        }

        public void ˋ(int i) {
            this.maxRows_ = i;
        }

        public String ˎ() {
            return this.layoutName_;
        }

        public void ˏ(String str) {
            this.layoutName_ = str;
        }

        public long ˋ() {
            return this.layoutId_;
        }

        public void ॱ(long j) {
            this.layoutId_ = j;
        }

        public int ॱ() {
            return cib.ˏ(this.layoutName_);
        }

        public String ˏ() {
            if (TextUtils.isEmpty(this.css_)) {
                return "." + this.layoutName_;
            }
            return this.css_;
        }

        public void ॱ(String str) {
            this.css_ = str;
        }

        public String toString() {
            return "Layout {\n\tlayoutId_: " + String.valueOf(this.layoutId_) + "\n\tlayoutName_: " + this.layoutName_ + "\n\tmaxRows_: " + String.valueOf(this.maxRows_) + "\n}";
        }
    }

    public static class LayoutData<T> extends JsonBean {
        @FieldPrint(print = PrintLevel.PRINTABLE)
        private List<T> dataList = null;
        private int isInstalledFilter_;
        private int isUpdatableFilter_;
        private long layoutId_;
        private String layoutName_;

        public List<T> ˋ() {
            return this.dataList;
        }

        public void ॱ(List<T> list) {
            this.dataList = list;
        }

        public int ॱ() {
            return this.isUpdatableFilter_;
        }

        public void ॱ(int i) {
            this.isUpdatableFilter_ = i;
        }

        public int ˊ() {
            return this.isInstalledFilter_;
        }

        public void ˎ(int i) {
            this.isInstalledFilter_ = i;
        }

        public String ˏ() {
            return this.layoutName_;
        }

        public void ॱ(String str) {
            this.layoutName_ = str;
        }

        public long ˎ() {
            return this.layoutId_;
        }

        public void ˋ(long j) {
            this.layoutId_ = j;
        }

        public void fromJson(JSONObject jSONObject) throws IllegalArgumentException, IllegalAccessException, InstantiationException, ClassNotFoundException, JSONException {
            super.fromJson(jSONObject);
            if (jSONObject.has(BaseDetailResponse.DATALIST_KEY)) {
                try {
                    ˋ(jSONObject);
                } catch (Exception e) {
                    Logger.ˋ(BaseDetailResponse.TAG, "fromJson(JSONObject jsonObject) Exception:" + e.getClass().getSimpleName() + ",layoutName_: " + this.layoutName_);
                }
            }
        }

        private void ˋ(JSONObject jSONObject) throws JSONException, InstantiationException {
            cif ˎ;
            Object obj;
            cif o_cif;
            Object obj2;
            JSONArray jSONArray = (JSONArray) jSONObject.get(BaseDetailResponse.DATALIST_KEY);
            Class ˊ = cib.ˊ(this.layoutName_.toLowerCase(Locale.US));
            this.dataList = new ArrayList();
            int i = 0;
            cif o_cif2 = null;
            Object obj3 = null;
            while (i < jSONArray.length()) {
                try {
                    CardBean cardBean = (CardBean) ˊ.newInstance();
                    cardBean.fromJson((JSONObject) jSONArray.get(i));
                    if (obj3 == null) {
                        ˎ = ˎ(jSONObject, cardBean);
                        obj = 1;
                    } else {
                        ˎ = o_cif2;
                        obj = obj3;
                    }
                    try {
                        cardBean.ˊ(ˎ);
                        this.dataList.add(cardBean);
                        o_cif = ˎ;
                        obj2 = obj;
                    } catch (IllegalAccessException e) {
                        o_cif = ˎ;
                        obj2 = obj;
                        Logger.ˋ(BaseDetailResponse.TAG, "data create failed IllegalAccessException");
                        i++;
                        obj3 = obj2;
                        o_cif2 = o_cif;
                    } catch (InstantiationException e2) {
                        o_cif = ˎ;
                        obj2 = obj;
                        Logger.ˋ(BaseDetailResponse.TAG, "data create failed InstantiationException");
                        i++;
                        obj3 = obj2;
                        o_cif2 = o_cif;
                    } catch (ClassNotFoundException e3) {
                        o_cif = ˎ;
                        obj2 = obj;
                        Logger.ˋ(BaseDetailResponse.TAG, "data create failed ClassNotFoundException");
                        i++;
                        obj3 = obj2;
                        o_cif2 = o_cif;
                    } catch (JSONException e4) {
                        o_cif = ˎ;
                        obj2 = obj;
                        Logger.ˋ(BaseDetailResponse.TAG, "data create failed JSONException");
                        i++;
                        obj3 = obj2;
                        o_cif2 = o_cif;
                    }
                } catch (IllegalAccessException e5) {
                    o_cif = o_cif2;
                    obj2 = obj3;
                    Logger.ˋ(BaseDetailResponse.TAG, "data create failed IllegalAccessException");
                    i++;
                    obj3 = obj2;
                    o_cif2 = o_cif;
                } catch (InstantiationException e6) {
                    o_cif = o_cif2;
                    obj2 = obj3;
                    Logger.ˋ(BaseDetailResponse.TAG, "data create failed InstantiationException");
                    i++;
                    obj3 = obj2;
                    o_cif2 = o_cif;
                } catch (ClassNotFoundException e7) {
                    o_cif = o_cif2;
                    obj2 = obj3;
                    Logger.ˋ(BaseDetailResponse.TAG, "data create failed ClassNotFoundException");
                    i++;
                    obj3 = obj2;
                    o_cif2 = o_cif;
                } catch (JSONException e8) {
                    o_cif = o_cif2;
                    obj2 = obj3;
                    Logger.ˋ(BaseDetailResponse.TAG, "data create failed JSONException");
                    i++;
                    obj3 = obj2;
                    o_cif2 = o_cif;
                }
                i++;
                obj3 = obj2;
                o_cif2 = o_cif;
            }
        }

        private cif ˎ(JSONObject jSONObject, CardBean cardBean) {
            cif o_cif;
            cif o_cif2 = null;
            if (cardBean.ߵ() == null || !jSONObject.has(BaseDetailResponse.DISPLAY_CONFIG_KEY)) {
                return null;
            }
            try {
                Object obj = jSONObject.get(BaseDetailResponse.DISPLAY_CONFIG_KEY);
                if (obj instanceof JSONObject) {
                    o_cif = (cif) cardBean.ߵ().newInstance();
                    try {
                        o_cif.fromJson((JSONObject) obj);
                    } catch (JSONException e) {
                        o_cif2 = o_cif;
                        Logger.ˋ(BaseDetailResponse.TAG, "do not DISPLAY_CONFIG_KEY");
                        return o_cif2;
                    } catch (IllegalAccessException e2) {
                        o_cif2 = o_cif;
                        Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "IllegalAccessException");
                        return o_cif2;
                    } catch (InstantiationException e3) {
                        o_cif2 = o_cif;
                        Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "InstantiationException");
                        return o_cif2;
                    } catch (ClassNotFoundException e4) {
                        o_cif2 = o_cif;
                        Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "ClassNotFoundException");
                        return o_cif2;
                    }
                }
                o_cif = null;
                return o_cif;
            } catch (JSONException e5) {
                Logger.ˋ(BaseDetailResponse.TAG, "do not DISPLAY_CONFIG_KEY");
                return o_cif2;
            } catch (IllegalAccessException e6) {
                Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "IllegalAccessException");
                return o_cif2;
            } catch (InstantiationException e7) {
                Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "InstantiationException");
                return o_cif2;
            } catch (ClassNotFoundException e8) {
                Logger.ˋ(BaseDetailResponse.TAG, cardBean.ߵ() + "ClassNotFoundException");
                return o_cif2;
            }
        }
    }

    public static class ShareInfo extends JsonBean implements Serializable {
        private static final long serialVersionUID = -4170419962132607688L;
        private String shareDesc_;
        private String shareIcon_;
        private String shareTitle_;
        private String shareUrl_;

        public String ˋ() {
            return this.shareTitle_;
        }

        public String ˏ() {
            return this.shareDesc_;
        }

        public String ˊ() {
            return this.shareUrl_;
        }

        public String ˎ() {
            return this.shareIcon_;
        }
    }

    public String ͺ() {
        return this.categoryName_;
    }

    public List<Layout> ʻॱ() {
        return this.layout_;
    }

    public void ˊ(List<Layout> list) {
        this.layout_ = list;
    }

    public List<LayoutData<T>> ᐝॱ() {
        return this.layoutData_;
    }

    public void ॱ(List<LayoutData<T>> list) {
        this.layoutData_ = list;
    }

    public String ˋ() {
        return this.name_;
    }

    public void ˏ(String str) {
        this.name_ = str;
    }

    public String ॱˋ() {
        return this.statKey_;
    }

    public int ॱ() {
        return this.hasNextPage_;
    }

    public void ˏ(int i) {
        this.hasNextPage_ = i;
    }

    public ArrayList<TabInfo> ॱᐝ() {
        return this.defaultTabInfo_;
    }

    public JSONObject ॱˎ() {
        if (epw.ˏ()) {
            return null;
        }
        return this.css_;
    }

    public void ˏ(JSONObject jSONObject) {
        this.css_ = jSONObject;
    }

    public int ˈ() {
        return this.supportResort_;
    }

    public int ʾ() {
        return this.isSupSearch_;
    }

    public void ˋ(int i) {
        this.isSupSearch_ = i;
    }

    public ArrayList<TabInfo> ˎ() {
        return this.tabInfo_;
    }

    public int ʿ() {
        return this.count_;
    }

    public int ʼॱ() {
        return this.marginTop_;
    }

    public DataFilterSwitch ʽॱ() {
        return this.dataFilterSwitch_;
    }

    public ShareInfo ˊˊ() {
        return this.shareInfo_;
    }

    public String ˉ() {
        return this.titleType_;
    }

    public void ॱ(String str) {
        this.titleType_ = str;
    }

    public SpinnerInfo ˊˋ() {
        return this.spinnerInfo_;
    }

    public String ˋˊ() {
        return this.returnTabId_;
    }

    public int ˊᐝ() {
        return this.pageNum;
    }

    public void ˊ(int i) {
        this.pageNum = i;
    }
}
